package com.ryskoo.controller.basicdata;

import com.ryskoo.basicdata.organization.domain.OrganizationPO;
import com.ryskoo.basicdata.organization.service.IOrganizationService;
import com.ryskoo.framework.core.controller.BasicHandler;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;

import java.util.List;


/**
 * 组织机构访问控制器
 * 组织机构的查询、新增、编辑、删除入口
 * @author thq
 */
@Controller
@RequestMapping("/vendor/basicdata/organization")
public class OrganizationController extends BasicHandler<OrganizationPO> {

    private IOrganizationService organizationService;
    /**
     * 基类构造方法.
     */
    public OrganizationController() {
        super("system/basicdata/organization", "Organization");
    }

    /**
     * 消费者注入
     *
     * @param logoConsumer 消费者基类
     */
    @Autowired
    protected void setService(IOrganizationService organizationService) {
        this.organizationService = organizationService;
        super.setService(organizationService);
    }

    
	@Override
	protected void buildListPageData(Model model, HttpServletRequest request) {
		// 获取所有部门传送到页面
		List<OrganizationPO> list = organizationService.getByParentId("");
		model.addAttribute("topDepts", list);
	}
}
